package com.sumainfor.pc.gmio.controller.epc;

import com.sumainfor.common.util.FieldCheckUtil;
import com.sumainfor.common.util.JsonResult;
import com.sumainfor.pc.gmio.service.impl.tenant.BillService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * 功能描述:
 *
 * @Auther: zhlu
 * @Date: 2019/5/10 14:44
 * @Description:
 */
@RestController
@RequestMapping("/key/repbill")
public class RepairBillController {

    @Autowired
    BillService BillService;

    /**
     * 功能描述: 
     * 根据维修编号获取账单资料
     * @Author zhlu
     * @Description //TODO
     * @Date 2019/5/10 14:46
     */
    @GetMapping("/getRepairBillMap")
    public JsonResult getRepairBillMap(@RequestParam Map<String,Object> params){
        JsonResult result=new JsonResult();
        if(!FieldCheckUtil.isMapFieldNotNull(params,new String[]{"BiId"})){
            result.putFailed("BiId不能为空！");
            return  result;
        }
        result.put(BillService.getRepairBillMap(params));
        return result;
    }

    /**
     * 查询维修账单
     * @author zhoucong
     * @data 2019/10/23
     * @Param
     * @return
     */
    @GetMapping("/getRepairBillMapOne")
    public JsonResult getRepairBillMapOne(@RequestParam Map<String,Object> params){
        JsonResult result=new JsonResult();
        if(!FieldCheckUtil.isMapFieldNotNull(params,new String[]{"Source"})){
            result.putFailed("Source不能为空！");
            return  result;
        }
        result.put(BillService.getRepairBillMap(params));
        return result;
    }

}
